package com.demo.controller;

import com.demo.pojo.Model;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

/**
 * @ClassName AjaxTest
 * @Description TODO
 * @Author Windy
 * @Date 2022/9/5 15:25
 * @Version 1.0
 **/
@Controller
@RequestMapping("ajax")
public class AjaxTest {

    @ResponseBody
    @PostMapping("getId")
    public Model getId(int id){
        System.out.println(id);
        Model model = new Model();
        model.setName("aaaa"+id);
        model.setPassword("123"+id);

        return model;
    }

    @ResponseBody
    @PostMapping("getModel")
    public Model getModel(@RequestBody Model model){
        System.out.println(model);
        model.setName("change");
        return model;
    }


}
